﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

///==============================
//作者：李彰楠
//日期：2020/7/5
//
//名称：MessageBase
//
//描述：MonoBase之间通信的消息和数据
//
///==============================
namespace gameFramework_v1dot0_lzn
{
    //传递ID
    public class MessageBase 
    {
        //表示65535个消息，占用2个字节
        public ushort msgId;

        //只传递消息ID
        public MessageBase(ushort tempMsg)
        {
            this.msgId = tempMsg;
        }

        public ManagerID GetManager()
        {
            int tempId = msgId / FrameTools.MsgSpawn;
            //Debug.Log((tempId * FrameTools.MsgSpawn));
            return (ManagerID)(tempId * FrameTools.MsgSpawn);
        }
    }

    //传递ID + Transform
    public class MsgTransform : MessageBase
    {
        public Transform value;

        public MsgTransform():base(0)
        {

        }

        public MsgTransform(ushort _tempId,Transform _tempTransform) : base(_tempId)//对父类进行构造
        {
            this.msgId = _tempId;
            this.value = _tempTransform;
        }
    }

    //传递ID + String
    public class MsgString : MessageBase
    {
        public string value;

        public MsgString() : base(0)
        {

        }

        public MsgString(ushort _tempId, string _tempString) : base(_tempId)//对父类进行构造
        {
            this.msgId = _tempId;
            this.value = _tempString;
        }
    }

    //传递ID + Int
    public class MsgInt : MessageBase
    {
        public int value;

        public MsgInt() : base(0)
        {

        }

        public MsgInt(ushort _tempId, int _tempInt) : base(_tempId)//对父类进行构造
        {
            this.msgId = _tempId;
            this.value = _tempInt;
        }
    }
}
